<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script>
        /*
         * Devboot is a temp solution that is used for testing purposes
         * ... (no PHP there ;)). So if anyone wonders whats the
         * "dont-deploy" folder, it contains stuff which are used for
         * development/debugging/internal demo purposes and it should
         * not be deployed to production.
         *
         * This also setups the localStorage so that:
         *
         * 0) Clear the localStorage
         *
         * 1) Debug mode is enabled - e.g. a lot of stuff will be
         *    printed in the dev console, via console.* and the
         *    MegaLogger.
         *
         * 2) Static path is dynamically set to ../../ (relative to
         *    dont-deploy/devboot.html). This means that the staticPath
         *    should be correctly set even if you have your project
         *    running in localhost/meganz-webclient/ or customVhost/ +
         *    it will work with http OR https.
         *
         * 3) Will force the secureboot to load the actual .js files
         *    instead of just pushing ALL javascript files into a single
         *    blog: (this was really helpful for debugging the JS code
         *    using the Chrome debugger).
         */
        var devhost = window.location.host;
        var pathSuffix = window.location.pathname;

        pathSuffix = pathSuffix.split('/').slice(0, -2).join('/');

        // Clear old localStorage data and settings
        localStorage.clear();

        // Add ?apipath=staging to the end of the URL if you want to
        // use the staging API, apipath=prod for the live API servers,
        // or leave blank for Sandbox 3.
        if (window.location.search.indexOf('apipath=prod') > -1) {
            localStorage.apipath = 'https://g.api.mega.co.nz/';
        }
        // For payments to work properly on Staging API, you need to be on the company network or MEGA VPN. If you
        // have an IPv6 address from your ISP, often it will _not_ be routed via the VPN. Staging4 only works on
        // IPv4 so all MEGA API traffic will be forced to go through the VPN and thus payments will work properly.
        else if (window.location.search.indexOf('apipath=staging4') > -1) {
            localStorage.apipath = 'https://staging4.api.mega.co.nz/';
        }
        else if (window.location.search.indexOf('apipath=staging') > -1) {
            localStorage.apipath = 'https://staging.api.mega.co.nz/';
        }
        else if (window.location.search.indexOf('apipath=sandbox4') > -1) {
            localStorage.apipath = 'https://api-sandbox4.developers.mega.co.nz/';
        }
        else if (window.location.search.indexOf('apipath=sandbox2') > -1) {
            localStorage.apipath = 'https://api-sandbox2.developers.mega.co.nz/';
        }
        // Servers nz{1-5}-api-sandbox3 are used by different API developers for testing
        else if (window.location.search.indexOf('apipath=nz1') > -1) {
            localStorage.apipath = 'https://nz1-api-sandbox3.developers.mega.co.nz/';
        }
        else if (window.location.search.indexOf('apipath=nz2') > -1) {
            localStorage.apipath = 'https://nz2-api-sandbox3.developers.mega.co.nz/';
        }
        else if (window.location.search.indexOf('apipath=nz3') > -1) {
            localStorage.apipath = 'https://nz3-api-sandbox3.developers.mega.co.nz/';
        }
        else if (window.location.search.indexOf('apipath=nz4') > -1) {
            localStorage.apipath = 'https://nz4-api-sandbox3.developers.mega.co.nz/';
        }
        else if (window.location.search.indexOf('apipath=nz5') > -1) {
            localStorage.apipath = 'https://nz5-api-sandbox3.developers.mega.co.nz/';
        }
        else {
            // Used for QA of some projects
            localStorage.apipath = 'https://api-sandbox3.developers.mega.co.nz/';
        }

        // Show all payment gateways regardless of country selection
        if (window.location.search.indexOf('allpaygates=1') > -1) {
            localStorage.enableAllPaymentGateways = '1';
        }

        // Use MEGA Pay test domain (Stripe card dialog iframe on the Pro Payment page)
        if (window.location.search.indexOf('testmegapay=1') > -1) {
            localStorage.megaPay = 'https://test.megapay.nz/index.html';
        }
        if (window.location.search.indexOf('testmegapay=localhost') > -1) {
            localStorage.megaPay = 'http://stripe.megapay.local/index.html';
        }

        // Force the new secure registration method on or off for testing
        if (window.location.search.indexOf('securereg=1') > -1) {
            localStorage.newRegistrationEnabled = '1';
        }
        else if (window.location.search.indexOf('securereg=0') > -1) {
            localStorage.newRegistrationEnabled = '0';
        }

        // Force the Two-Factor authentication on or off for testing. This just shows/hides the 2FA section in the
        // My Account area of desktop and mobile web. It overrides the API flag value
        if (window.location.search.indexOf('twofactor=1') > -1) {
            localStorage.twoFactorAuthEnabled = '1';
        }
        else if (window.location.search.indexOf('twofactor=0') > -1) {
            localStorage.twoFactorAuthEnabled = '0';
        }

        // SMS debug mode for testing the same phone number multiple times
        if (window.location.search.indexOf('sms=1') > -1) {
            localStorage.smsDebugMode = '1';
        }

        // Use the beta CMS if requested
        if (window.location.search.indexOf('betacms=1') > -1) {
            localStorage.cms = 'https://cms2.systems.mega.nz/';
        }

        // Force viewing of the mobile site if requested
        if (window.location.search.indexOf('mobile=1') > -1) {
            localStorage.testMobileSite = '1';
        }

        // Some flags for testing the Open in App feature on mobile
        if (window.location.search.indexOf('testOpenInApp=ios') > -1) {
            localStorage.testOpenInApp = 'ios';
        }
        else if (window.location.search.indexOf('testOpenInApp=android') > -1) {
            localStorage.testOpenInApp = 'android';
        }
        else if (window.location.search.indexOf('testOpenInApp=winphone') > -1) {
            localStorage.testOpenInApp = 'winphone';
        }

        // Use old URL hash logic for everything e.g. mega.nz/#blog instead of mega.nz/blog
        if (window.location.search.indexOf('hashLogic') > -1) {
            localStorage.hashLogic = 1;
        }

        // Disable the cryptographic hash verification logic.
        localStorage.dd = '1';

        // Set the static path to the current host if requested
        // Useful if testing https://mega.nz on a beta server and using /etc/hosts to override the real ip
        if (window.location.search.indexOf('staticpath=currenthost') > -1) {
            localStorage.staticpath = window.location.protocol + "//" + devhost + pathSuffix + "/";
            localStorage.defaultstaticpath = localStorage.staticpath;

            // For this to work, also uncomment block in secureboot.js with comment:
            // "Disable hash checking if requested for development"
            localStorage.disablecontentcheck = '1';
        }

        // Turn on full debugging.
        localStorage.d = '1'; // Using console.*
        localStorage.minLogLevel = '-1'; // Using MegaLogger, '0' = MegaLogger.LEVELS.DEBUG.

        // Load script files separately for easier debugging
        if (window.location.search.indexOf('jj=') > -1) {
            localStorage.jj = '1';
        }
        if (window.location.search.indexOf('jj=2') > -1) {
            localStorage.jjnocache = '1';
        }

        if (window.location.search.indexOf('contentcheck=') > -1) {
            sessionStorage.dbgContentCheck = '1';
            delete localStorage.jj;
        }

        // localStorage.contextmenu = '1';
        // localStorage.stopOnAssertFail = '1';
        // localStorage.allowBreakpointsOnReload = '1';

        // Chat stuff.
        // localStorage.dxmpp = '1';
        // localStorage.chatDisabled = '1';
        // localStorage.testChatDisabled = '1';

        // Does this still work?
        localStorage.allowBreakpointsOnReload = '1';

        // Retain current hash on redirect so you can give a test link to the direct page
        window.location = '../' + location.hash;
    </script>
</head>
<body>

</body>
</html>
